<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>地市指标-劣化描述</title>
    <link rel="stylesheet" href="../source/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="../source/bootstrap-table-1.11.1/bootstrap-table.min.css">
    <script src="../source/jquery/jquery-1.10.2.min.js"></script>
    <script src="../source/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../source/bootstrap-table-1.11.1/bootstrap-table.js"></script>
    <script src="../source/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../source/iconfont/iconfont.js"></script>
    <script src="../source/echarts.min.js"></script>
    <!-- <script src="../source/echarts-all.js"></script>-->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <style>
        .icon {
            width: 1em;
            height: 1em;
            vertical-align: -0.15em;
            fill: currentColor;
            overflow: hidden;
            font-size: 20px;
            line-height: 30px;
            margin-right: 0px;
            margin-left: 0px;
        }

        .row {
            margin-right: 0px;
            margin-left: 0px;
        }

        .noswap {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .fixed-table-container thead th .th-inner {
            padding: 6px;
        }

        #table1 td {
            height: 30px;
            padding: 6px;
        }

        .bootstrap-table .table.table-no-bordered>tbody>tr>td,
        .bootstrap-table .table.table-no-bordered>thead>tr>th {
            border-right: 1px solid transparent;
        }

        .table.table-no-bordered>tbody>tr>td {
            padding: 3px;
        }

        .fixed-table-container thead th:first-child {

            border-top-left-radius: 0px;
            -webkit-border-top-left-radius: 0px;
        }

        .timeshowno {
            float: left;
            color: #FBDBDD;
            margin-left: 28%;
            padding-top: 0.094em;
        }

        .timeshowyes {
            float: left;
            color: #FBDBDD;
            margin-left: 1%;
            padding-top: 0.094em;
        }

        .showdetailsno {
            float: right;
            margin-right: 20%;
            display: block;
            background-color: #0072C2;
            color: #FBDBDD;
            padding: 1px 5px 1px 5px;
        }

        .showdetailsyes {
            float: right;
            margin-right: 20%;
            display: block;
            background-color: #0072C2;
            color: #FBDBDD;
            padding: 1px 5px 1px 5px;
        }
    </style>

</head>
    <body>
        <div class="container-fluid" style="height: 100%;padding-left: 0px;padding-right: 0px;">
            <div class="row" style="height: 13%; background-color: #169BFA;text-align: center;">
                <div class="row" style="height: 60%;position: relative;">
                    <div style="width:100%;position: absolute; bottom: 0;">
                        <span id="inD_DATA" style="color:#DCF2FF;font-size:xx-large"></span>
                        <span style="color:#DCF2FF;"></span>
                        <span id="lasttime_data" style="color:#68F200; margin-right: 0px;">
                            <svg class="icon" aria-hidden="true">
                                <use xlink:href="#icon-jiantou3"></use>
                            </svg>
                        </span>
                    </div>
                </div>
                <div class="row" style="display: block;height: 40%;position: relative;">
                    <div id="Showpad" style="width:100%;position: absolute; bottom: 5px;">
                        <span id="iS_Degradation" style="display: none; margin-left: 10%;width: 4.643em;height:1.429em ;float:left;padding: 2px;background-image: url(../imgs/img_liehua.png);background-size: 100% 100%;color:#FBDBDD;box-shadow:1px 1px 1px #F47D78;margin-right: 10px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                        <span id="timeShow" class="timeshowno" style=""></span>

                        <span id="details" class="showdetailsno" style="">详情</span>
                    </div>
                </div>
            </div>
            <div class="row" style="height: 87%;text-align: center;">
                <div id="tishi" class="row" style="height: 10%;position:relative;">
                    <div style="width: 100%; position: absolute;top: 15px;">
                    </div>
                </div>
                <div id="MarB" class="row" style="height: 5%;position:relative;margin-bottom: 3.8em">
                    <div style="width: 100%; position: absolute;top: 1em;">
                        <div style="background-color: #4FCC54;color:#FBDBDD;box-shadow:1px 1px 1px #4FCC54;margin-right:0.875em;margin-left:0.875em;position: relative">

                            <span id="rEmake" style="z-index:99;padding:0.625em  0.825em;width:100%;text-align:left;float: left;background-color: #4FCC54;color:#FBDBDD;line-height:inherit  ">

                            </span>
                        </div>
                        <span style="color:#A4A4A4;margin-top:0.5em "> 数据来源：</span>
                        <span id="responsibledepT_NAME" style=";margin-top: 0.5em">  </span>
                        <svg class="icon" aria-hidden="true" style="font-size: 20px;color:#A4A4A4;margin-top: 0.5em">

                            <use xlink:href="#icon-vertical_line"></use>

                            <span style="color:#A4A4A4;margin-top: 0.5em "> 责任部</svg>门：</span>
                        <span id="departmenT_NAME" style=";margin-top: 0.5em">  </span>
                    </div>
                </div>
                <!--table-->
                <div id="showHe" class="row" style="height: 22%;position: relative;">
                    <div style="width:100%;position: absolute;padding: 10px 10px 0px 10px; ">
                        <table id="table1"></table>
                    </div>
                </div>
                <!--tab-->
                <div id="tab" class="row" style="width: 80%;border-radius: 3em 3em 3em 3em / 3em 3em;box-shadow: 1px 1px 1px 1px #1899FA;margin-top: 1.5em;margin-left: 10%;padding: 2px 5px 2px 5px;">
                    <!--<div id="tab1" class="col-xs-6" style="border-radius: 3em 3em 3em 3em / 3em 3em;background-color: #1899FA">指标值</div>
            <div id="tab2" class="col-xs-6" style="border-radius: 3em 3em 3em 3em / 3em 3em;">劣化幅度</div>-->
                    <!--<div id="tab3" class="col-xs-4" style="border-radius: 3em 3em 3em 3em / 3em 3em;">排名</div>-->
                </div>
                <!--折线图-->
                <div class="row" style="margin-left: 10px;margin-right:10px;height: 40%;">
                    <div id="echart1" style="height:100%;width: 100%;"></div>
                </div>
            </div>
        </div>
    </body>

<script type="text/javascript">
    
    function getQueryString(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return null;
    }
    
    $(document).ready(function () {

        //alert($(window).height()); //浏览器当前窗口可视区域高度
        //alert($(document).height()); //浏览器当前窗口文档的高度
        document.getElementsByTagName('body')[0].style.height = $(window).height() + 'px';
        //var json = '{"cityName":"全省","s_id":"B08I00135"}
        var indId = getQueryString("s_id");
        var city = decodeURI(escape(getQueryString("cityName")));
        var Oneshow;
        var Twoshow;
        var Threeshow;

        var indDetailUrl ="http://111.8.20.247:89/api/apph5api/getkeywhereidetail";
        var indDayUrl = "http://111.8.20.247:89/api/apph5api/getkeywhereisddata";
        var cityRankUrl ="http://111.8.20.247:89/api/apph5api/getkeywhereranking";
        var htmlTab = '';
        if (city == "全省") {
            $("#showHe").css('height', '22%');
            $("#details").css('display','block');

            $("#Showpad").css('padding-left','0em');
            htmlTab =
                    '<div id="tab1" class="col-xs-6" style="height:30px;line-height:30px;border-radius: 3em 3em 3em 3em / 3em 3em;background-color: #1899FA;color:#ffffff;">指标值</div>' +
                    '<div id="tab2" class="col-xs-6" style="height:30px;line-height:30px;border-radius: 3em 3em 3em 3em / 3em 3em;">劣化幅度</div>';



        } else {
            $("#showHe").css('height', '30%');
            $("#details").css('display','none');
            $("#Showpad").css('padding-left','2em');
            htmlTab =
                    '<div id="tab1" class="col-xs-4" style="height:30px;line-height:30px;border-radius: 3em 3em 3em 3em / 3em 3em;background-color: #1899FA;color:#ffffff;">指标值</div>' +
                    '<div id="tab2" class="col-xs-4" style="height:30px;line-height:30px;border-radius: 3em 3em 3em 3em / 3em 3em;">劣化幅度</div>' +
                    '<div id="tab3" class="col-xs-4" style="height:30px;line-height:30px;border-radius: 3em 3em 3em 3em / 3em 3em;">指标排名</div>';


        }
        $("#tab").html(htmlTab);
        $.ajax({
            url: indDetailUrl + "?CITY_NAME=" + city + "&S_id=" + indId,
            type: "get",
            dataType: "jsonp",
            success: function (res) {
                //var res = {"code":"1","desc":"success","result":[{"time":"2018-01-30 00:00:00","provincE_NAME":"湖南省","citY_NAME":"全省","s_id":"D01S01I002","lasttime_data":4.78,"iS_Degradation":0,"inD_DATA":10.29,"absolutE_THD":10.0,"sorT_IDS":"0","baD_THD":5.0,"departmenT_NAME":"话务网管系统","responsibledepT_NAME":"网管中心\r"}]};
                var result = res.result;
                console.log(res,"rese")
                if(result.iS_Degradation=="0"){
                    $("#timeShow").removeClass("timeshowno");
                    $("#details").removeClass("showdetailsno");
                    $("#timeShow").removeClass("timeshowyes");
                    $("#details").removeClass("showdetailsyes");
                    document.getElementById("iS_Degradation").style.display = "none";
                    $("#timeShow").addClass("timeshowno");
                    $("#details").addClass("showdetailsno");
                }else{
                    document.getElementById("iS_Degradation").style.display="inline-block";
                    $("#timeShow").removeClass("timeshowno");
                    $("#details").removeClass("showdetailsno");
                    $("#timeShow").removeClass("timeshowyes");
                    $("#details").removeClass("showdetailsyes");
                    $("#timeShow").addClass("timeshowyes");
                    $("#details").addClass("showdetailsyes");
                }

                $("#inD_DATA").html(result.inD_DATA);
                $("#timeShow").html(result.time);

                var hEight = $("#rEmake").height();
                console.log(hEight);
                if (result.remak && result.remak.length > 22) {
                    var nuM = result.remak.length;

                    var oNe = result.remak.slice(0, 22);
                    var tWo = result.remak.slice(22, nuM);

                    $("#rEmake").html(oNe + tWo);
                    $("#rEmake").css('text-align', 'left');
                    $('#MarB').css('margin-bottom', '5.3em');

                    $("#rEmake").css('line-heght', hEight + 'px');


                } else {
                    $("#rEmake").html(result.remak);
                    $("#rEmake").css('text-align', 'left');
                    $('#MarB').css('margin-bottom', '3.8em');

                    $("#rEmake").css('line-heght', hEight + 'px');

                }

//                    var  Num11= 0;
//                    result.iS_Degradation =Num11



debugger
                var ifDegradation="";
                if(result.sorT_IDS == 0){
                    if (result.lasttime_data >= 0) {




                        $("#lasttime_data").html("&nbsp;" + result.lasttime_data + '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiantou3"></use></svg>');

                        $("#lasttime_data").css('color','#6EFB78');



                        /*$("#timeShow").removeClass("timeshowno");
                        $("#details").removeClass("showdetailsno");
                        $("#timeShow").removeClass("timeshowyes");
                        $("#details").removeClass("showdetailsyes");
                        document.getElementById("iS_Degradation").style.display = "none";
                        $("#timeShow").addClass("timeshowno");
                        $("#details").addClass("showdetailsno");*/

                    } else {
                        $("#lasttime_data").html("&nbsp;" + result.lasttime_data + '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiantou1-copy-copy"></use></svg>');
                        $("#lasttime_data").css('color','#FF0000');



                        /*$("#timeShow").removeClass("timeshowno");
                        $("#details").removeClass("showdetailsno");
                        $("#timeShow").removeClass("timeshowyes");
                        $("#details").removeClass("showdetailsyes");
                        document.getElementById("iS_Degradation").removeAttribute("display");
                        $("#timeShow").addClass("timeshowyes");
                        $("#details").addClass("showdetailsyes");*/
                    }

                }
                else {

                    if (result.lasttime_data >= 0) {
                        $("#lasttime_data").html("&nbsp;" + result.lasttime_data + '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiantou1-copy-copy"></use></svg>');
                        $("#lasttime_data").css('color','#FF0000');


                        /*$("#timeShow").removeClass("timeshowno");
                        $("#details").removeClass("showdetailsno");
                        $("#timeShow").removeClass("timeshowyes");
                        $("#details").removeClass("showdetailsyes");
                        document.getElementById("iS_Degradation").removeAttribute("display");
                        $("#timeShow").addClass("timeshowyes");
                        $("#details").addClass("showdetailsyes");*/

                    } else {
                        $("#lasttime_data").html("&nbsp;" + result.lasttime_data + '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiantou3"></use></svg>');
                        $("#lasttime_data").css('color','#6EFB78');


                        /*$("#timeShow").removeClass("timeshowno");
                        $("#details").removeClass("showdetailsno");
                        $("#timeShow").removeClass("timeshowyes");
                        $("#details").removeClass("showdetailsyes");

                        document.getElementById("iS_Degradation").style.display = "none";
                        $("#timeShow").addClass("timeshowno");
                        $("#details").addClass("showdetailsno");*/

                    }



                }


                if (result.inD_DATA >= result.absolutE_THD) {
                    document.getElementById("tishi").style.display = "none";
                } else {

                    document.getElementById("tishi").style.display = "none";
                }
                $("#responsibledepT_NAME").html(result.departmenT_NAME);
                $("#departmenT_NAME").html(result.responsibledepT_NAME);
                var tableData = [];

                Oneshow = result.absolutE_THD;
                Twoshow = result.baD_THD;
                loadLineData("tab1", Oneshow);



                var MinVaOth;

                if(result.sorT_IDS == "0"){

                    if(parseFloat(result.lasttime_data)<parseFloat(result.baD_THD)){
                        MinVaOth= "是"


                    }
                    else if(parseFloat(result.lasttime_data)<parseFloat(result.baD_THD)){
                        MinVaOth= "是"


                    }else{

                        MinVaOth= "否"
                    }
                }
                else {
                    if(parseFloat(result.lasttime_data)<parseFloat(result.baD_THD)){

                        MinVaOth= "否"

                    }else{

                        MinVaOth= "是"
                    }
                }


                tableData.push({
                    "reason": "指标值",
                    "val": result.absolutE_THD,
                    "curval": result.inD_DATA,
                    "istrue": result.iS_Degradation == 0 ? "否" : "是"
                });
                tableData.push({
                    "reason": "劣化幅度",
                    "val": result.baD_THD,
                    "curval": result.lasttime_data,
                    "istrue": MinVaOth,
                });


                if (city != "全省") {
                    $.ajax({
                        url: cityRankUrl + "?CITY_NAME=" + city + "&S_id=" + indId,
                        type: "get",
                        //async: false,
                        dataType: 'jsonp',
                        success: function (res) {
                            var result = res.result;
                            debugger
                            var item = {
                                "reason": "指标排名",
                                "val": result[0].iscolor,
                                "curval": result[0].topnum,
                                "istrue": result[0].topnum < result[0].iscolor ? "否" :"是"
                            };
                            /*if(item.istrue=="是"){
                                document.getElementById("iS_Degradation").style.display="inline-block";
                                $("#timeShow").removeClass("timeshowno");
                                $("#details").removeClass("showdetailsno");
                                $("#timeShow").removeClass("timeshowyes");
                                $("#details").removeClass("showdetailsyes");
                                $("#timeShow").addClass("timeshowyes");
                                $("#details").addClass("showdetailsyes");
                            }else{
                            }*/
                            $("#table1").bootstrapTable('append', [item]);

                        }
                    });

                }
               /* $(tableData).each(function(index,item){
                    if(item.istrue=="是"){
                        document.getElementById("iS_Degradation").style.display="inline-block";
                        $("#timeShow").removeClass("timeshowno");
                        $("#details").removeClass("showdetailsno");
                        $("#timeShow").removeClass("timeshowyes");
                        $("#details").removeClass("showdetailsyes");
                        $("#timeShow").addClass("timeshowyes");
                        $("#details").addClass("showdetailsyes");
                    }else{
                    }
                })*/
                $("#table1").bootstrapTable({
                    data: tableData,
                    classes: "table table-hover table-no-bordered table-striped",
                    search: false,
                    pagination: false,
                    showColumns: false,
                    showRefresh: false,
                    showToggle: false,
                    locale: "zh-CN",
                    striped: true,
                    columns: [ //color:#A4A4A4
                        {
                            field: "reason",
                            title: "劣化原因",
                            width: "25%",
                            height: '36',
                            align: "left",
                            class: "noswap"
                        },
                        {
                            field: "val",
                            title: "门限值",
                            width: "25%",
                            align: "left"
                        },
                        {
                            field: "curval",
                            title: "当前值",
                            width: "25%",
                            align: "left"
                        },
                        {
                            field: "istrue",
                            title: "是否劣化",
                            width: "25%",
                            align: "center",
                            formatter: function (value, row, index) {
                                if (row.istrue === "是") {
                                    row.istrue =
                                            '<span style="color:#FF0000; ">' + row.istrue +
                                            '</span>';
                                }
                                return row.istrue;
                            }
                        }
                    ],
                    onPostHeader: function () {
                        //修改表格背景颜色
                        var ths = document.getElementsByTagName('th');
                        for (var i = 0; i < ths.length; i++) {
                            ths[i].style.backgroundColor = '#169BFA';
                            ths[i].style.color = '#ffffff';
                            ths[i].style.backgroundImage = 'none';
                        }

                    }
                });
            }
        });

        //加载指标值、劣化幅度折线图
        function loadLineData(type, Data) {
            $.ajax({
                url: indDayUrl + "?CITY_NAME=" + city + "&S_id=" + indId,
                type: "get",
                dataType: "jsonp",
                success: function (res) {
                    var result = res.result;

                    ;
                    var xData = [],
                            yData = [],
                            yValue = 0,
                            xValue = 0;
                    for (var i in result) {
                        xData.push(result[i].time.replace(/年|月/g, "-").replace("日", "").slice(5));

                        //                            console.log(TestData);
                        //                            xData.push(result[i].time.replace(/年|月/g,"-").replace("日",""));
                        if (type == "tab1") {
                            yData.push(result[i].inD_DATA);

//                                yValue = result[i].inD_DATA > yValue ? result[i].inD_DATA : yValue;
//                                xValue = result[i].inD_DATA > xValue ? result[i].inD_DATA : xValue;

                            xValue= (yData&&yData.length>0)?Math.min.apply(null,yData):0,
                                    yValue=(yData&&yData.length>0)?Math.max.apply(null,yData):100;

                            //xValue = 0;
                        } else {
                            if (result[i].lasttime_data == null) {
                                yData.push(0);
                                yValue = result[i].lasttime_data > yValue ? result[i]
                                        .lasttime_data : yValue;
                                xValue = result[i].lasttime_data < xValue ? result[i]
                                        .lasttime_data : xValue;

                            } else {
                                yData.push(result[i].lasttime_data);
                                yValue = result[i].lasttime_data > yValue ? result[i]
                                        .lasttime_data : yValue;
                                xValue = result[i].lasttime_data < xValue ? result[i]
                                        .lasttime_data : xValue;

                            }

                        }

                    }

                    createLineChart(xData, yData, yValue, xValue, Data);





//                    var timer = setInterval(function(){    //开启定时器，
//                        Moveright();
//
//
//                    },3000);
//                    clearInterval(timer);


                }
            });


        }



        //加载排名饼图
        function loadBarData(Data) {
            $.ajax({
                url: cityRankUrl + "?CITY_NAME=" + city + "&S_id=" + indId,
                type: "get",
                dataType: "jsonp",
                success: function (res) {

                    var result = res.result;
                    //对json进行降序排序函数
                    var colId="time";
                    var desc = function(x,y)
                    {
                        return (x[colId] < y[colId]) ? 1 : -1
                    }
                    //对json进行升序排序函数
                    var asc = function(x,y)
                    {
                        return (x[colId] > y[colId]) ? 1 : -1
                    }
                    var result = res.result;

                    result.sort(asc); //升序排序
                    result.sort();
                      var xData = [],
                            yData = [],
                            yValue = 0;
                    console.log(result,"result")
                    for (var i in result) {

                        if(result[i].time==null){

                            //xData.push("");
                        }else{
                            xData.push(result[i].time.replace(/年|月/g, "-").replace("日", "").slice(5));
                            yData.push(result[i].topnum);
                            yValue = result[i].topnum > yValue ? Math.ceil(result[i].topnum) :
                                    yValue;

                        }



                    }

                    xData.sort();
                    createBarChart(xData, yData, yValue, Data);
                    //$("#table1").bootstrapTable('append', [{"reason":"排名","val":10,"curval":result[0].topnum,"istrue":result[0].topnum < 10?"否":"是"}]);
                }
            });
        }

        //折线图，饼图制作
        function createLineChart(dataX, dataY, valueY, valueX, Data) {
            echarts.dispose(document.getElementById('echart1'));
            var myChart = echarts.init(document.getElementById('echart1'));
            var MinVa;
            var MaxVa;

            if(valueX>100000){
                var test1 =Math.floor( valueX/10000);
                MinVa= test1*10000;
            }
            else if(valueX>10000){
                var test1 =Math.floor( valueX/1000);
                MinVa= test1*1000;
            }
            else if(valueX>1000){
                var test1 =Math.floor( valueX/100);
                MinVa= test1*100 ;
            }
            else  if(valueX>100){
                var test1 =Math.floor( valueX/10);
                MinVa= test1*10 ;
            }
            else if(valueX>10){
                var test1 =Math.floor( valueX/10);
                MinVa= test1*10 ;
            }
            else if(valueX>5){
                MinVa= 5 ;
            }
            else if(valueX>4){
                MinVa= 4 ;
            }
            else if(valueX>3){
                MinVa= 3 ;
            }
            else if(valueX>2){
                MinVa= 2 ;
            }
            else  if(valueX>1){
                MinVa= 1 ;
            }
            else  if(valueX>0.9){
                MinVa= 0.9 ;
            }
            else  if(valueX>0.8){
                MinVa= 0.8 ;
            }
            else  if(valueX>0.7){
                MinVa= 0.7;
            }
            else  if(valueX>0.6){
                MinVa= 0.6 ;
            }
            else  if(valueX>0.5){
                MinVa= 0.5 ;
            }
            else  if(valueX>0.4){
                MinVa= 0.4 ;
            }
            else  if(valueX>0.3){
                MinVa= 0.3 ;
            }
            else  if(valueX>0.2){
                MinVa= 0.2 ;
            }
            else  if(valueX>0.1){
                MinVa= 0.1 ;
            }
            else  if(valueX>0.09){
                MinVa= 0.09 ;
            }
            else  if(valueX>0.08){
                MinVa= 0.08 ;
            }
            else  if(valueX>0.07){
                MinVa= 0.07 ;
            }
            else  if(valueX>0.06){
                MinVa= 0.06 ;
            }
            else  if(valueX>0.05){
                MinVa= 0.05 ;
            }
            else  if(valueX>0.04){
                MinVa= 0.04 ;
            }
            else  if(valueX>0.03){
                MinVa= 0.03 ;
            }
            else  if(valueX>0.02){
                MinVa= 0.02 ;
            }
            else  if(valueX>0.01){
                MinVa= 0.01 ;
            }
            else if(valueX>0){
                MinVa=0 ;
            }
            else if(valueX>-0.01){
                MinVa= -0.01 ;
            }
            else if(valueX>-0.02){
                MinVa= -0.02 ;
            }
            else if(valueX>-0.03){
                MinVa= -0.03 ;
            }
            else if(valueX>-0.04){
                MinVa= -0.04 ;
            }
            else if(valueX>-0.05){
                MinVa= -0.05 ;
            }
            else if(valueX>-0.06){
                MinVa= -0.06 ;
            }
            else if(valueX>-0.07){
                MinVa= -0.07 ;
            }
            else if(valueX>-0.08){
                MinVa= -0.08 ;
            }
            else if(valueX>-0.09){
                MinVa= -0.09 ;
            }
            else if(valueX>-0.1){
                MinVa= -0.1 ;
            }
            else if(valueX>-0.2){
                MinVa= -0.2 ;
            }
            else if(valueX>-0.3){
                MinVa= -0.3 ;
            }
            else if(valueX>-0.4){
                MinVa= -0.4 ;
            }
            else if(valueX>-0.5){
                MinVa= -0.5 ;
            }else if(valueX>-0.6){
                MinVa= -0.6 ;
            }
            else if(valueX>-0.7){
                MinVa= -0.7 ;
            }
            else if(valueX>-0.8){
                MinVa= -0.8 ;
            }
            else if(valueX>-0.9){
                MinVa= -0.9 ;
            }
            else if(valueX>-1){
                MinVa= -1 ;
            }
            else if(valueX>-2){
                MinVa= -2 ;
            }
            else if(valueX>-3){
                MinVa= -3 ;
            }
            else if(valueX>-4){
                MinVa= -4 ;
            }
            else if(valueX>-5){
                MinVa= -5 ;
            }
            else if(valueX>-10){
                var test1 =Math.floor( valueX);
                MinVa= test1 ;
            }
            else if(valueX>-100){
                var test1 =Math.floor( valueX/10);
                MinVa= test1*10 ;
            }
            else if(valueX>-1000){
                var test1 =Math.floor( valueX/100);
                MinVa= test1*100 ;
            }
            else if(valueX>-10000){
                var test1 =Math.floor( valueX/1000);
                MinVa= test1*1000 ;
            }
            else if(valueX>-100000){
                var test1 =Math.floor( valueX/10000);
                MinVa= test1*10000 ;
            }
            else{
                MinVa=valueX ;
            }



            if(valueY>100000){
                var test1 =Math.ceil( valueY/10000);
                MaxVa= test1*10000 ;
            }
            else if(valueY>10000){
                var test1 =Math.ceil( valueY/1000);
                MaxVa= test1*1000 ;
            }
            else if(valueY>1000){
                var test1 =Math.ceil( valueY/100);
                MaxVa= test1*100 ;
            }
            else  if(valueY>100){
                var test1 =Math.ceil( valueY/10);
                MaxVa= test1*10 ;
            }
            else if(valueY>10){
                var test1 =Math.ceil( valueY/10);
                MaxVa= test1*10 ;

            }
            else if(valueY>5){
                MaxVa= 10 ;
            }
            else if(valueY>4){
                MaxVa= 5 ;
            }
            else if(valueY>3){
                MaxVa= 4 ;
            }
            else if(valueY>2){
                MaxVa= 3 ;
            }
            else  if(valueY>1){
                MaxVa= 2 ;
            }
            else if(valueY>0.9){
                MaxVa= 1 ;
            }
            else if(valueY>0.8){
                MaxVa= 0.9 ;
            }
            else if(valueY>0.7){
                MaxVa= 0.8 ;
            }
            else if(valueY>0.6){
                MaxVa= 0.7 ;
            }
            else if(valueY>0.5){
                MaxVa= 0.6 ;
            }
            else if(valueY>0.4){
                MaxVa= 0.5 ;
            }
            else if(valueY>0.3){
                MaxVa= 0.4 ;
            }
            else if(valueY>0.2){
                MaxVa= 0.3 ;
            }
            else if(valueY>0.1){
                MaxVa= 0.2 ;
            }
            else if(valueY>0.09){
                MaxVa= 0.1 ;
            }
            else if(valueY>0.08){
                MaxVa= 0.09 ;
            }
            else if(valueY>0.07){
                MaxVa= 0.08 ;
            }
            else if(valueY>0.06){
                MaxVa= 0.07 ;
            }
            else if(valueY>0.05){
                MaxVa= 0.06 ;
            }
            else if(valueY>0.04){
                MaxVa= 0.05 ;
            }
            else if(valueY>0.03){
                MaxVa= 0.04 ;
            }
            else if(valueY>0.02){
                MaxVa= 0.03 ;
            }
            else if(valueY>0.01){
                MaxVa= 0.02 ;
            }
            else if(valueY>0){
                MaxVa=0.01 ;
            }else if(valueY>-0.01){
                MaxVa= 0 ;
            }
            else if(valueY>-0.02){
                MaxVa= -0.01 ;
            }
            else if(valueY>-0.03){
                MaxVa= -0.02 ;
            }
            else if(valueY>-0.04){
                MaxVa= -0.03 ;
            }
            else if(valueY>-0.05){
                MaxVa= -0.04 ;
            }
            else if(valueY>-0.06){
                MaxVa= -0.05 ;
            }
            else if(valueY>-0.07){
                MaxVa= -0.06 ;
            }
            else if(valueY>-0.08){
                MaxVa= -0.07 ;
            }
            else if(valueY>-0.09){
                MaxVa= -0.08 ;
            }
            else if(valueY>-0.1){
                MaxVa= -0.09 ;
            }
            else if(valueY>-0.2){
                MaxVa= -0.1 ;
            }
            else if(valueY>-0.3){
                MaxVa= -0.2 ;
            }
            else if(valueY>-0.4){
                MaxVa= -0.3 ;
            }
            else if(valueY>-0.5){
                MaxVa= -0.4 ;
            }
            else if(valueY>-0.6){
                MaxVa= -0.5 ;
            }
            else if(valueY>-0.7){
                MaxVa= -0.6 ;
            }
            else if(valueY>-0.8){
                MaxVa= -0.7 ;
            }
            else if(valueY>-0.9){
                MaxVa= -0.8 ;
            }
            else if(valueY>-1){
                MaxVa= -0.9 ;
            }
            else if(valueY>-2){
                MaxVa= -1 ;
            }
            else if(valueY>-3){
                MaxVa= -2 ;
            }
            else if(valueY>-4){
                MaxVa= -3 ;
            }
            else if(valueY>-5){
                MaxVa= -4 ;
            }
            else if(valueY>-10){
                var test1 =Math.floor( valueY);
                MaxVa= test1 ;
            }
            else if(valueY>-100){
                var test1 =Math.floor( valueY/10);
                MaxVa= test1*10 ;
            }
            else if(valueY>-1000){
                var test1 =Math.floor( valueY/100);
                MaxVa= test1*100 ;
            }
            else if(valueY>-10000){
                var test1 =Math.floor( valueY/1000);
                MaxVa= test1*1000 ;
            }
            else if(valueY>-100000){
                var test1 =Math.floor( valueY/10000);
                MaxVa= test1*10000 ;
            }
            else{
                MaxVa=valueY ;
            }



            option = {
                tooltip: {
                    show: true,
                    trigger: 'axis',
                },
                grid: {
                    top: 30,
                    right:'10%',
                    width:'78%',
                },

                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: dataX,
                    axisLine: {
                        show: false,
                        onZero: false
                    },
                    axisLabel: {
                        interval: 0,
                        rotate: 45
                    },
                    splitLine: {
                        show: false
                    }
                },
                yAxis: {
                    type: 'value',
                    min: MinVa,
                    max: MaxVa,
                    axisLabel:{
                        interval:1,
                    },
//                        axisTick: {length:valueY/4},
                    splitNumber: 2,//y 轴的分割段数
                    minInterval:0.1,//自动计算的坐标轴最小间隔大小。
//                        maxInterval: 100,//自动计算的坐标轴最大间隔大小。
                    splitLine: {
                        show: true,
                        lineStyle: {
                            type: 'solid',
                            color: '#d4d4d4', //左边线的颜色
                            opacity: 0.2,
                            width: '1' //坐标线的宽度
                        }
                    }, //去除网格线


                    axisLine: {
                        show: false,
                        onZero: false
                    }
                },
                dataZoom: {
                    type: 'inside',
                    show: true,
                    zoomLock: true,
                    xAxisIndex: [0],
                    start: 50, //默认为起始位置百分比(%)；
                    end: 100//结束位置(%)
                },
                series: [{
                    data: dataY,
                    smooth: true,
                    type: 'line',
                    symbol: 'circle',
                    clickable: true,
                    lineStyle: {
                        color: '#179bfa'
                    },
                    itemStyle: {
                        color: '#179bfa'
                    },
                    areaStyle: {
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: '#34a7fb' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'White' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        }
                    },
                    markLine: {
                        data: [{
                            name: '门限',
                            yAxis: Data,
                        }],
                        lineStyle: {
                            type: 'dashed'
                        },
                        label: {
                            show: true,
                            formatter: '{b}'
                        }
                    }
                }]
            };

            myChart.setOption(option);


        }

        function createBarChart(dataX, dataY, valueY, Data) {

            echarts.dispose(document.getElementById('echart1'));
            var myChart = echarts.init(document.getElementById('echart1'));

            var option = {
                tooltip: {
                    show: true,
                    trigger: 'axis',
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: true,
                    data: dataX,
                    axisLine: {
                        show: false
                    },
                    axisLabel: {
                        interval: 0,
                        rotate: 45
                    },
                    splitLine: {
                        show: false
                    }
                },
                grid: {
                    top: 20,
                    containLabel: false,
                    borderWidth: 0,
                    borderColor: '#dbdbdb',
                    right:30,
                    x: 20,
                    y: 50
                },
                left: 0,

                yAxis: {
                    type: 'value',
                    min: 0,
                    max: valueY,
                    splitNumber: 0,
                    axisLine: {
                        show: false
                    },
                    splitLine: {
                        show: false
                    }
                },
                series: [{
                    data: dataY,
                    type: 'bar',
                    barCategoryGap: '60%',
                    barWidth:'15',

                    itemStyle: {
                        color: function (v) {
                            if (v.value >= 50) {
                                return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: '#34a7fb'
                                }, {
                                    offset: 1,
                                    color: '#fff'
                                }]);
                            }
                            return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                offset: 0,
                                color: '#34a7fb'
                            }, {
                                offset: 1,
                                color: '#fff'
                            }]);
                        }
                    },
                    areaStyle: {
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: '#34a7fb' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'White' // 100% 处的颜色
                            }],
                            globalCoord: false // 缺省为 false
                        }
                    },
                    markLine: {
                        data: [{
                            name: '门限',
                            yAxis: Data,
                        }],
                        lineStyle: {

                            type: 'dashed'
                        },
                        label: {
                            show: true,
                            formatter: '{b}'
                        }
                    }
                }]
            };
            myChart.setOption(option);


        }

        function turnTo(url) {
            if (window.htmlView) {
                window.htmlView.redirectToPage(url);
            } else {
                window.location.href = url;
            }
        }

        $("#tab").click(function (e) {

            var tabId = e.target.id;
            $.ajax({
                url: indDetailUrl + "?CITY_NAME=" + city + "&S_id=" + indId,
                type: "get",
                dataType: "jsonp",
                success: function (res) {

                    var result = res.result;

                    var tableData = [];

                    var Oneshow1 = result.absolutE_THD;
                    var Twoshow1 = result.baD_THD;



                    if ("tab1" == tabId) {
                        loadLineData(tabId, Oneshow1);
                    } else if ("tab2" == tabId) {
                        loadLineData(tabId, Twoshow1);


                    } else {
                        if (city != "全省") {
                            $.ajax({
                                url: cityRankUrl + "?CITY_NAME=" + city +
                                "&S_id=" + indId,
                                type: "get",
                                //async: false,
                                dataType: 'jsonp',
                                success: function (res) {
                                    var result = res.result;

                                    var ThreeData = result[0].iscolor;
                                    loadBarData(ThreeData);

                                }
                            });

                        }

                    }


                }
            });


            var divs = $("#tab").children('div');
            for (var i = 0; i < divs.length; i++) {
                if (tabId === divs[i].id) {
                    divs[i].style.borderRadius = '3em 3em 3em 3em / 3em 3em';
                    divs[i].style.height = '30px';
                    divs[i].style.lineHeight = '30px';
                    divs[i].style.color = '#ffffff';
                    divs[i].style.backgroundColor = '#169BFA';
                } else {
                    divs[i].removeAttribute('style');
                    divs[i].style.height = '30px';
                    divs[i].style.lineHeight = '30px';
                }
            }
        });

        $("#tab1").click(function (e) {
            $("#tab").css('margin-bottom', '0em');

        });
        $("#tab2").click(function (e) {
            $("#tab").css('margin-bottom', '0em');

        });

        $("#tab3").click(function (e) {
            $("#tab").css('margin-bottom', '1.5em');

        });


        $("#details").click(function (e) {

            var url = "guide_tb_fd.html?cityName=";

            turnTo(url)

        });





    });


//    window.onload=function(){
//        function Moveright() {
//
//            var bot = document.getElementById('echart1');
//            bot.addEventListener('touchend', function () {
//             alert(111);
//            });
//            creatTouchstartEventAndDispatch(bot);
//
//
//        }
//
//        function creatTouchstartEventAndDispatch(el) {
//            var event = document.createEvent('Events');
//            event.initEvent('touchend', true, true);
//            el.dispatchEvent(event);
//
//        }
//
//        setTimeout(Moveright(), 3110);
//
//    };

</script>
</html>
